package com.cnxdc.demo.mapper;

import com.cnxdc.demo.vo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    @Select("select * from user where username=#{username}")
    User findUserByUsername(String username);

    @Insert("insert into user(username,password,create_time,update_time) values(#{username},#{password},#{createTime},#{updateTime})")
    void register(User user);

    @Update("update user set nickname=#{nickname},email=#{email} where id=#{id}")
    void update(User user);

    @Update("update user set user_pic=#{userPic} where id=#{id}")
    void updateUserPic(User user);

    @Update("update user set password=#{password},update_time=#{updateTime} where id=#{id}")
    void updatePwd(User user);
}
